home *** CD-ROM | disk | FTP | other *** search
- property theText, textFont, bgColor, textColor, textSize, textStyle, hiliteColor, hiliteStyle, selectColor, selectStyle, selectScript, selectSound, selectedLine, hilitedLine
-
- on new me
- return me
- end
-
- on getPropertyDescriptionList
- description = [:]
- addProp(description, #textFont, [#default: "Geneva", #format: #string, #comment: "Font of the text:"])
- addProp(description, #bgColor, [#default: 0, #format: #integer, #comment: "ID for the background color of text:"])
- addProp(description, #textColor, [#default: 256, #format: #integer, #comment: "ID for color of the text:"])
- addProp(description, #textSize, [#default: 12, #format: #integer, #comment: "Font size of the text:"])
- addProp(description, #textStyle, [#default: "plain", #format: #string, #comment: "Style of the text:"])
- addProp(description, #hiliteColor, [#default: 5, #format: #integer, #comment: "ID for color of hilited text:"])
- addProp(description, #hiliteStyle, [#default: "plain", #format: #string, #comment: "Style of the hilited text:"])
- addProp(description, #selectColor, [#default: 25, #format: #integer, #comment: "ID for color of selected text:"])
- addProp(description, #selectStyle, [#default: "bold", #format: #string, #comment: "Style of the selected text:"])
- addProp(description, #selectScript, [#default: "none", #format: #string, #comment: "Script when making a selection:"])
- addProp(description, #selectSound, [#default: "none", #format: #string, #comment: "Sound played when making a selection:"])
- return description
- end
-
- on getBehaviorDescription
- return "Simple selectable list with normal, hilited, and select text colors and styles, and click-sound."
- end
-
- on beginSprite me
- puppetSprite(me.spriteNum, 1)
- me.selectedLine = 1
- me.hilitedLine = 0
- X = me.spriteNum
- Y = the memberNum of sprite X
- z = member(Y).backcolor
- member(the memberNum of sprite me.spriteNum).backcolor = me.bgColor
- set the foreColor of member the memberNum of sprite the spriteNum of me to me.textColor
- set the textFont of member the memberNum of sprite the spriteNum of me to me.textFont
- set the textStyle of member the memberNum of sprite the spriteNum of me to me.textStyle
- set the textSize of member the memberNum of sprite the spriteNum of me to me.textSize
- mSelect(me)
- end
-
- on endSprite me
- puppetSprite(me.spriteNum, 0)
- end
-
- on mouseWithin me
- if (me.hilitedLine <> the mouseLine) and (the mouseLine <> -1) and not SameStyles(me) then
- mClearField(me)
- mSelect(me)
- if the mouseLine <> me.selectedLine then
- set the textStyle of line the mouseLine of member the memberNum of sprite the spriteNum of me to me.hiliteStyle
- set the foreColor of line the mouseLine of member the memberNum of sprite the spriteNum of me to me.hiliteColor
- end if
- end if
- me.hilitedLine = the mouseLine
- end
-
- on mouseLeave me
- mClearField(me)
- mSelect(me)
- end
-
- on mouseUp me
- me.selectedLine = the mouseLine
- mClearField(me)
- mSelect(me)
- if me.selectSound <> "none" then
- puppetSound(me.selectSound)
- end if
- if me.selectScript <> "none" then
- do(me.selectScript)
- end if
- end
-
- on mSelect me
- set the foreColor of line the selectedLine of me of member the memberNum of sprite the spriteNum of me to me.selectColor
- set the textStyle of line the selectedLine of me of member the memberNum of sprite the spriteNum of me to me.selectStyle
- end
-
- on mHilite me
- set the foreColor of line the hilitedLine of me of member the memberNum of sprite the spriteNum of me to me.hiliteColor
- set the textStyle of line the hilitedLine of me of member the memberNum of sprite the spriteNum of me to me.hiliteStyle
- end
-
- on mClearField me
- set the textStyle of member the memberNum of sprite the spriteNum of me to me.textStyle
- set the foreColor of member the memberNum of sprite the spriteNum of me to me.textColor
- end
-
- on SameStyles me
- if (me.textColor = me.hiliteColor) and (me.textStyle = me.hiliteStyle) then
- return 1
- else
- return 0
- end if
- end
-